{% extends "admin/base_site.html" %}

<!-- LOADING -->
{% load i18n adminmedia fb_tags fb_versions %}

<!-- STYLESHEETS -->
{% block extrastyle %}
    {{ block.super }}
	<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />
    <link rel="stylesheet" type="text/css" href="{{ settings_var.URL_FILEBROWSER_MEDIA }}css/filebrowser.css" />
{% endblock %}

<!-- JAVASCRIPTS -->
{% block extrahead %}
	{{ block.super }}
	<script type="text/javascript" src="/admin/jsi18n/"></script>
	<script type="text/javascript" src="{% admin_media_prefix %}js/jquery.min.js"></script>
	<script type="text/javascript" src="{% admin_media_prefix %}js/jquery.init.js"></script>
	<script type="text/javascript" src="{% admin_media_prefix %}js/collapse.min.js"></script>
    {{ media }}
{% endblock %}

<!-- COLTYPE/BODYCLASS -->
{% block bodyclass %}change-form filebrowser{% if query.pop %} popup{% endif %}{% endblock %}
{% block content-class %}content-flexible{% endblock %}

<!-- BREADCRBUMBS -->
{% block breadcrumbs %}{% include "filebrowser/include/breadcrumbs.html" %}{% endblock %}

<!-- CONTENT -->
{% block content %}
<div id="content-main">
    <form action="{% query_string "" "filter_date,filter_type,q,p" %}" method="post">{% csrf_token %}
		<div>
            {% if form.errors %}<p class="errornote">{% trans 'Please correct the following errors.' %}</p>{% endif %}
            <fieldset class="module aligned">
                <div class="form-row {% if form.name.errors %}errors{% endif %}">
                    <div>
					    <label class="required" for="id_name">{{ form.name.label }}</label>
                        {{ form.name }}
                        {% if form.name.errors %}<ul class="errorlist">{{ form.name.errors }}</ul>{% endif %}
                        {% if form.name.help_text %}<p class="help">{{ form.name.help_text|safe }}</p>{% endif %}
                    </div>
                </div>
            </fieldset>
            {% if fileobject.filetype == "Image" %}
            <fieldset class="module aligned collapse open">
                <h2>{% trans "Edit" %}</h2>
                <div class="form-row {% if form.transpose.errors %}errors{% endif %}">
                    <div>
					    <label class="required" for="id_transpose">{{ form.transpose.label }}</label>
                        {{ form.transpose }}
                        {% if form.transpose.errors %}<ul class="errorlist">{{ form.transpose.errors }}</ul>{% endif %}
                        {% if form.transpose.help_text %}<p class="help">{{ form.transpose.help_text|safe }}</p>{% endif %}
                    </div>
                </div>
            </fieldset>
            {% endif %}
            {% if fileobject.filetype == "Folder" %}
            <fieldset class="module aligned collapse open">
                <h2>{% trans "Folder Information" %}</h2>
                <div class="form-row">
                    <div>
					    <label>{% trans "Date" %}</label>
                        <p class="readonly">
                            {{ fileobject.datetime|date:"N j, Y" }}
                        </p>
                    </div>
                </div>
            </fieldset>
            {% endif %}
            {% if fileobject.filetype != "Folder" %}
            <fieldset class="module aligned collapse open">
                <h2>{% trans "File Information" %}</h2>
                <div class="form-row">
                    <div>
					    <label>{% trans "URL" %}</label>
                        <p class="readonly">
                            <a href="{{ fileobject.url }}">{{ fileobject.url }}</a>
                        </p>
                    </div>
                </div>
                <div class="form-row">
                    <div>
					    <label>{% trans "Filesize" %}</label>
                        <p class="readonly">
                            {{ fileobject.filesize|filesizeformat }}
                        </p>
                    </div>
                </div>
                <div class="form-row">
                    <div>
					    <label>{% trans "Date" %}</label>
                        <p class="readonly">
                            {{ fileobject.datetime|date:"N j, Y" }}
                        </p>
                    </div>
                </div>
                {% if fileobject.filetype == "Image" %}
                    <div class="form-row">
                        <div>
						    <label>{% trans "Size" %}</label>
                            <p class="readonly">
                                {{ fileobject.width }} x {{ fileobject.height }} px
                            </p>
                        </div>
                    </div>
                {% endif %}
            </fieldset>
            {% endif %}
            {% if fileobject.filetype == "Image" %}
            <fieldset class="module aligned collapse closed">
                <h2>{% trans "Image Versions" %}</h2>
                {% if settings_var.ADMIN_THUMBNAIL %}
                <div class="form-row">
                    <div>
					    <label>{% trans "Thumbnail" %}</label>
                        <img src="{% version fileobject.path settings_var.ADMIN_THUMBNAIL %}" title="{% trans 'View Image' %}" />
                    </div>
                </div>
                {% endif %}
                {% if settings_var.ADMIN_VERSIONS %}
                    {% for version in settings_var.ADMIN_VERSIONS %}
                        {% version_object fileobject version as image_version %}
                        {% version_setting version %}
                        <div class="form-row">
                            <div>
							    <label>{{ version_setting.verbose_name }}</label>
                                <img src="{{ image_version.url }}" />
                            </div>
                        </div>
                    {% endfor %}
                {% endif %}
            </fieldset>
            {% endif %}
            <div class="submit-row">
				<p class="deletelink-box">
                	<a href="{% url fb_delete_confirm %}{% query_string %}" class="deletelink">{% trans "Delete" %}</a>
				</p>
                <input type="submit" value="{% trans 'Save' %}" class="default" />
                <input type="submit" value="{% trans 'Save and continue editing' %}" name="_continue" />
            </div>
		</div>
    </form>
</div>
{% endblock %}